#include "stm32f10x.h"                  // Device header
#include "Delay.h"
#include "Buzzer.h"
#include "Key.h"
#include "CounterSensor.h"

uint8_t KeyNum;
uint8_t CounterSensorState;

int main(void)
{
	Buzzer_Init();
	Key_Init();
	CounterSensor_Init();
	
	while(1)
	{	
		KeyNum = Key_GetNum();
		if(KeyNum == 1)
		{
			Buzzer_Set(ON);
		}
		if(KeyNum == 2)
		{
			Buzzer_Set(OFF);
		}
		if(KeyNum == 0)
		{
			CounterSensorState = CounterSensor_GetState();
			if(CounterSensorState == 1)
			{
				Buzzer_Set(ON);
			}
			else
			{
				Buzzer_Set(OFF);
			}
		}
		
	}
}
